package com.sd.jdbc;
import java.sql.*;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class StatementGetValues {
	public static void main(String[] args) throws Exception{
		//registering the driver
			//Class.forName("oracle.jdbc.oracle.OracleDriver");
		DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
			System.out.println("driver registered");
			//Established connection
			Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
			System.out.println("connection Established");
			//create statement
			Statement stm=conn.createStatement();
			//execute query
			ResultSet rs=stm.executeQuery("select *from Emp1");
			while(rs.next()){
			System.out.println(rs.getInt(1) + " " + rs.getString(2));
			//System.out.println(rs.getInt(2));
			//System.out.println(rs.getInt(3));
			//System.out.println(rs.getInt("======"));

			}

			conn.close();
		}

}
